(define (square-tree tree)
  (map (lambda (x)
         (if (pair? x)
           (square-tree x)
           (square x)))
       tree))

(define (square-tree tree)
  (cond ((null? tree) '())
        ((not (pair? tree)) (square tree))
        (else (cons (square-tree (car tree))
                    (square-tree (cdr tree))))))

(square-tree
  (list 1
        (list 2 (list 3 4) 5)
        (list 6 7)))
